//
//  XYDJViewController.m
//  YaDiuDiu
//
//  Created by 欧洪飞 on 2017/8/30.
//  Copyright © 2017年 jy. All rights reserved.
//

#import "XYDJViewController.h"

#import "PGMXViewController.h"
@interface XYDJViewController ()
@property (weak, nonatomic) IBOutlet UILabel *labXYDJ;
@property (weak, nonatomic) IBOutlet UILabel *labJF;
@property (weak, nonatomic) IBOutlet UILabel *labDate;

@end

@implementation XYDJViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    [self showNav:@"信用等级"];
    
    
    [self loadData];
}

- (IBAction)clickPG:(id)sender {
    PGMXViewController *pgmx = [[PGMXViewController alloc] init];
    [self.navigationController pushViewController:pgmx animated:YES];
}
//用户查看信用等级
- (void)loadData{
    
    NSString *str = [NSString stringWithFormat:@"%@890d69e502d1d37a9e84335ccefece57",[user objectForKey:@"token2"]];
    NSString *token = [LCMD5Tool md5:str];
    NSMutableDictionary *parmas = [NSMutableDictionary dictionary];
    [parmas setObject:token forKey:@"verifyToken"];
    [parmas setObject:[user objectForKey:@"userid"] forKey:@"userid"];
    
    NSString *url = [NSString stringWithFormat:@"%@/App/Usercenter/userCredit",urlHead];
    [[AFHTTPSessionManager manager] POST:url parameters:parmas success:^(NSURLSessionDataTask *task, id responseObject) {
        NSLog(@"用户查看信用等级res:%@",responseObject);
        NSString *state = [NSString stringWithFormat:@"%li",[[responseObject objectForKey:@"status"] integerValue]];
        if ([state integerValue] == 200) {
            _labJF.text = [NSString stringWithFormat:@"%li",[[responseObject objectForKey:@"content"] integerValue]];
        }else{
            [SVProgressHUD showErrorWithStatus:state];
        }
        
    } failure:^(NSURLSessionDataTask *task, NSError *error) {
        NSLog(@"error:%@",error);
    }];
    
    
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
